import request from '@/utils/request'

// 供应商
export function supplier(query) {
  return request({
    url: '/erp_api/zhouyz/supplier/list',
    method: 'get',
    params: query
  })
}

// 供应商详情
export function supplierDetail(query) {
  return request({
    url: `/erp_api/zhouyz/supplier/${query.id}`,
    method: 'get'
  })
}

// 采购付款
export function purchasePayment(query) {
  return request({
    url: '/erp_api/zhouyz/payment/list',
    method: 'get',
    params: query
  })
}

// 采购单
export function purchaseOrder(query) {
  return request({
    url: '/erp_api/zhouyz/purchaseOrder/list',
    method: 'get',
    params: query
  })
}

// 采购单确认收货
export function purchaseReceiving(query) {
  return request({
    url: '/erp_api/zhouyz/purchaseOrder/sure-receiving',
    method: 'get',
    params: query
  })
}

// 采购单作废
export function purchaseInvalid(data) {
  return request({
    url: '/erp_api/zhouyz/purchaseOrder/invalid',
    method: 'post',
    data: data
  })
}

// 采购单详情
export function purchaseOrderDetail(query) {
  return request({
    url: `/erp_api/zhouyz/purchaseOrder/${query.id}`,
    method: 'get'
  })
}

// 供应商商品
export function supplierProduct(query) {
  return request({
    url: '/erp_api/zhouyz/supplierProduct/list',
    method: 'get',
    params: query
  })
}

// 供应商商品详情
export function supplierProductDetail(query) {
  return request({
    url: `/erp_api/zhouyz/supplierProduct/${query.id}`,
    method: 'get'
  })
}

// 采购需求
export function purchaseDemand(query) {
  return request({
    url: '/erp_api/zhouyz/purchaseDemand/list',
    method: 'get',
    params: query
  })
}

// 采购需求详情
export function purchaseDemandDetail(query) {
  return request({
    url: `/erp_api/zhouyz/purchaseDemand/${query.id}`,
    method: 'get'
  })
}

// 采购需求商品
export function purchaseDemandProduct(query) {
  return request({
    url: '/erp_api/zhouyz/purchaseDemandProduct/list',
    method: 'get',
    params: query
  })
}

// 采购需求仓库
export function purchaseDemandWarehouse(query) {
  return request({
    url: `/erp_api/zhouyz/purchaseDemand/warehouse-list-by-demandId/${query.id}`,
    method: 'get'
  })
}

// 销售需求汇总
export function salesmanDemandProductSummary(query) {
  return request({
    url: '/erp_api/zhouyz/salesmanDemand/product/summary',
    method: 'get',
    params: query
  })
}

// 采购退货
export function purchaseReturn(query) {
  return request({
    url: '/erp_api/zhouyz/purchaseReturn/list',
    method: 'get',
    params: query
  })
}

// 采购退货详情
export function purchaseReturnDetail(query) {
  return request({
    url: `/erp_api/zhouyz/purchaseReturn/${query.id}`,
    method: 'get'
  })
}

// 采购退货商品
export function purchaseReturnProduct(query) {
  return request({
    url: `/erp_api/zhouyz/purchaseReturnProduct/list-return-id/${query.id}`,
    method: 'get'
  })
}
